<html>

	<head>
            <link rel="stylesheet" type="text/css" href="scripts/prueba.css"/>
	</head>

	<body>

		<div class="pcpal">
                <div class="menu">
                <?php
                    require_once("scripts/Menu.php");
                ?>
                </div>
                <div class="content1">
                    <img src="/AppResiduos2/images/6331428.jpg" alt="energia" style="width: 800px; height: 330px;" align="middle">
                </div>
                <div class="content2">

		<form action="/AppResiduos2/control/TranspResiduoControl.php" method="post">
	<?php if (isset($_POST['newTranspResiduos'])){
                require_once("/var/www/AppResiduos2/lib/dao/EmpresaDAO.php");
                $tDAO = new EmpresaDAO();
                $tran = $tDAO->listarTransportadores();
                $id_residue = $_POST['id_residue'];
                $id_producer = $_POST['id_producer'];
                $quantity_residue = $_POST['quantity_residue'];
        ?>
			<input type="hidden" name="operation" value="newTranspResidue">
                        <input type="hidden" name="id_residue" value="<?php echo $id_residue; ?>">
                        <input type="hidden" name="id_producer" value="<?php echo $id_producer; ?>">
                        <table id="others">
                            <tr class="alt2">
                                <td>
                                    Transporter:
                                </td>
                                <td>
                                    <select size="1" name="residue_transporter">
                    <?php


                                    for($i = 0; $i < sizeof($tran); $i = $i + 1){

                    ?>
                                    <option selected value=<?php print_r($tran[$i]->name);?>><?php print_r($tran[$i]->name);?> </option>

                    <?php
                                    }
                    ?>
                                    </select>
                                </td>
                            </tr>
                            <tr class="alt2">
                                <td>
                                    Residue's available quantity:
                                </td>
                                <td>
                                    <input type="text" name="residue_quantity" value="<?php echo $quantity_residue;?>">
                                </td>
                            </tr>
                            <tr class="alt2">
                                <td>
                                    Residue's quantity for transport:
                                </td>
                                <td>
                                    <input type="text" name="residue_quantity_transport">
                                </td>
                            </tr>
                        
                    
	<?php
		}
		if (isset($_POST['modifyTranspResiduos'])){
                    $id_residue = $_POST['id_residue'];
                    $id_producer = $_POST['id_producer'];
                    $name_transporter = $_POST['name_transporter'];
                    $quantity_residue = $_POST['quantity_residue'];
	?>
			<input type="hidden" name="operation" value="modifyTranspResidue">
                        <input type="hidden" name="id_residue" value="<?php echo $id_residue; ?>">
                        <input type="hidden" name="id_producer" value="<?php echo $id_producer; ?>">
			<table id="others">
                            <tr class="alt2">
                                <td>
                                    Transporter's name:
                                </td>
                                <td>
                                    <input type="text"  name="residue_transporter" value="<?php echo $name_transporter ?>">
                                </td>
                            </tr>
                            <tr class="alt2">
                                <td>
                                    Residue's available quantity:
                                </td>
                                <td>
                                    <input type="text"  name="residue_quantity" value="<?php echo $quantity_residue ?>">
                                </td>
                            </tr>
                            <tr class="alt2">
                                <td>
                                    Residue's quantity for transport:
                                </td>
                                <td>
                                    <input type="text" name="residue_quantity_transport"> 
                                </td>
                            </tr>

	<?php
		}
		if (isset($_POST['deleteTranspResiduos'])){
		$id_residue = $_POST['id_residue'];
                $id_producer = $_POST['id_producer'];
                $name_transporter = $_POST['name_transporter'];
	?>
			<input type="hidden" name="operation" value="deleteTranspResidue">
                        <input type="hidden" name="id_residue" value="<?php echo $id_residue; ?>">
                        <input type="hidden" name="id_producer" value="<?php echo $id_producer; ?>">
                        <table id="others">
                            <tr class="alt2">
                                <td>
                                    Residue's transporter:
                                </td>
                                <td>
                                    <input type="text" name="residue_transporter" value="<?php echo $name_transporter ?>">
                                </td>
                            </tr>

	<?php
		}
	?>
                            <tr class="alt2">
                                <td></td>
                                <td>
                                    <input type="submit" value="Accept">
                                </td>
                            </tr>
                        </table>

		</form>
		</div>
                </div>

	</body>

</html>
